package com.lxq.live.service;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;


@Component
public class JMSService {

    @Autowired
    JmsMessagingTemplate messagingTemplate;
    @Autowired
    SimpMessagingTemplate simpMessagingTemplate;

    @JmsListener(destination = "lxqLiveNoticeQueue")
    public void receive(String msg){
        //System.out.println("收到消息："+msg);
        simpMessagingTemplate.convertAndSend("/global_notice",msg);
        messagingTemplate.convertAndSend(new ActiveMQQueue("finalControl"),"LXQLive收到");
    }
}
